import {createStore} from 'vuex'

export default createStore({
    state: {
        route: [{name: '首页', path: '/', depth: 0}],
    },
    getters: {},
    mutations: {
        updateRoute(state, route) {
            let find = state.route.find((i) => {
                    return i.path === route.path
                }
            )
            if (find === undefined){
                route.depth=state.route.length
                state.route.push(route)
            }else{
                state.route=state.route.slice(0, find.depth + 1)
            }
        },
        // updateCurrentTitle(state, title) {
        //     state.route.currentTitle=title
        // }
    },
    actions: {},
    modules: {}
})
